window.browser = 'none';		//browser name
window.ctx = '/';				//Web root path

//--------------------get the browser name-----------------
var _navigator = navigator.userAgent;
if(_navigator.indexOf("MSIE 9.0") != -1)
	window.browser = 'IE9';
else if(_navigator.indexOf("MSIE 8.0") != -1)
	window.browser = 'IE8';
else if(_navigator.indexOf("MSIE 7.0") != -1)
	window.browser = 'IE7';
else if(_navigator.indexOf("MSIE 6.0") != -1)
	window.browser = 'IE6';
else if(_navigator.indexOf("MSIE") != -1)
	window.browser = 'IE';
else if(_navigator.indexOf("FireFox") != -1)
	window.browser = 'FireFox';
else if(_navigator.indexOf("Chrome") != -1)
	window.browser = 'Chrome';
else if(_navigator.indexOf("Safari") != -1)
	window.browser = 'Safari';
else if(_navigator.indexOf("Opera") != -1)
	window.browser = 'Opera';
//--------------------get the browser name-----------------

//-----------------Array with max value--------------------
Array.max = function(ary){return Math.max.apply(Math,ary);};
Array.min = function(ary){return Math.min.apply(Math,ary);};
//-----------------Array with max value--------------------

//--------------------get the Context path-----------------
//get the current web path.example： http://localhost:8080/ems/Pages/Basic/Person.jsp
var curWwwPath = window.document.location.href;
//get the path of the behind the IP.example: ems/Pages/Basic/Person.jsp
var pathName = window.document.location.pathname;
var pos = curWwwPath.indexOf(pathName);
//get the IP.example: http://localhost:8080
var localhostPaht = curWwwPath.substring(0, pos);
//get the project name behind "/".example：/ems
var projectName = pathName.substring(0, pathName.substr(1).indexOf('/') + 1);
window.ctx = localhostPaht + projectName;
//--------------------get the Context path-----------------

//--------------------get the visual area width and height-----------------
function getVisualAreaWH(){
	var _wh = {};
	if(window.browser.indexOf('IE') != -1){
		var _w_ary = [document.documentElement.clientWidth,document.body.clientWidth,
		                       document.body.offsetWidth,document.body.scrollWidth];
		var _h_ary = [document.documentElement.clientHeight,document.body.clientHeight,
		                       document.body.offsetHeight,document.body.scrollHeight];
		_wh.width = Array.max(_w_ary);
		_wh.height =Array.max(_h_ary);
	}else if(window.browser == 'Chrome' || window.browser == 'FireFox'){
		_wh.width = document.body.clientWidth;
		_wh.height =document.body.clientHeight;
	}else{
		_wh.width = document.body.clientWidth;
		_wh.height =document.body.clientHeight;
	}
	return _wh;
}
//--------------------get the visual area width and height-----------------